ComponentOne Basic Library for UWP
Basic Library Overview / RangeSlider for UWP / RangeSlider for UWP Quick Start / Step 3 of 4: Adding Code to the Application
In This Topic
    Step 3 of 4: Adding Code to the Application
    In This Topic

    In the previous steps you set up the application's user interface and added controls to your application. In this step you'll add code to your application to finalize it.

    Complete the following steps:

    1. Select View | Code to switch to Code view.
    2. In Code view, add the following import statement to the top of the page:
    C#
    Copy Code
    using C1.Xaml;
    
    1. Create a MainPage_Loaded event handler and add it below the page constructor:
    C#
    Copy Code
    private void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                UpdateGradient();
            }
    
    1. Add the following code just after the MainPage_Loaded event handler to update the gradient values:
    C#
    Copy Code
    private void UpdateGradient()
            {
                if (c1rs1 != null)
                {
                    this.goldcol.Offset = this.c1rs1.LowerValue;
                    this.blackcol.Offset = this.c1rs1.UpperValue;
                }
            }
    
    1. Add code to the c1rs1_LowerValueChanged event handler so that it appears like the following:
    C#
    Copy Code
    private void c1rs1_LowerValueChanged(object sender, EventArgs e)
            {
                UpdateGradient();
            }
    
    1. Add code to the c1rs1_UpperValueChanged event handler so that it appears like the following:
    C#
    Copy Code
    c1rs1_UpperValueChanged(object sender, EventArgs e)
    {
        UpdateGradient();
    }
    

     In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.